import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import javax.swing.text.html.HTMLEditorKit.Parser;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

public class FileWriter {
	XMLStreamWriter writer;
	public FileWriter() throws FileNotFoundException, XMLStreamException {
		XMLOutputFactory factory = XMLOutputFactory.newInstance();
		 writer = factory.createXMLStreamWriter(
				new FileOutputStream("writenParty.xml"), "UTF-8");
XMLAusgabe("freigabe", "satzstatus", 3, "sieger");
	}

	private void XMLAusgabe(String freigabe, String satzstatus,
			int gegnerstatus, String sieger)
			throws XMLStreamException {
		// Der XML-Header wird erzeugt

		writer.writeStartDocument();
		// Zuerst wird das Wurzelelement mit Attribut geschrieben
		writer.writeStartElement("content");

		writer.writeStartElement("freigabe");
		writer.writeCharacters(freigabe);
		writer.writeEndElement();

		writer.writeStartElement("satzstatus");
		writer.writeCharacters(satzstatus);
		writer.writeEndElement();

		writer.writeStartElement("gegnerzug");
		writer.writeCharacters(Integer.toString(gegnerstatus));
		writer.writeEndElement();

		writer.writeStartElement("sieger");
		writer.writeCharacters(sieger);
		writer.writeEndElement();

		writer.writeEndElement();
		writer.writeEndDocument();
		writer.close();
	}

}
